<script type="text/javascript">
function checkForm() {
	spanError = document.getElementById('error');
	var checkRegExp = new RegExp("^[ \t]*$");
	if (document.createAdmin.login.value.length == 0
		|| checkRegExp.test(document.createAdmin.login.value)) {
		spanError.innerHTML = '<?php echo T_('Login empty.');?>';
		spanError.className = "usvn_error";
		return false;
	}
	if (document.createAdmin.lastname.value.length == 0
		|| checkRegExp.test(document.createAdmin.lastname.value)) {
		spanError.innerHTML = '<?php echo T_('Lastname empty.');?>';
		spanError.className = "usvn_error";
		return false;
	}
	if (!document.createAdmin.password.value.length || !document.createAdmin.password2.value.length) {
		spanError.innerHTML = '<?php echo T_('Password empty.');?>';
		spanError.className = "usvn_error";
		return false;
	}
	if (document.createAdmin.password.value != document.createAdmin.password2.value) {
		spanError.innerHTML = '<?php echo T_('Password incorrect (not the same).');?>';
		spanError.className = "usvn_error";
		return false;
	}
	if (document.createAdmin.password.value.length < 8) {
		spanError.innerHTML = '<?php echo T_('Password incorrect (need more 8 characters).');?>';
		spanError.className = "usvn_error";
		return false;
	}
	spanError.innerHTML = '';
	spanError.className = "";
	return true;
}
</script>

<div class="usvn_info">
	<h1><?php echo T_("Step");?> 6: <?php echo T_("Create administrator user"); ?></h1>
	<p><?php echo T_("Creation of the first administrator of USVN."); ?></p>
</div>
<div id="error"></div>
<form name="createAdmin" action="index.php?step=7" method="post">
<div id="usvn_logo_install_step"
	style="background-image: url(../medias/default/images/CrystalClear/128x128/apps/kdmconfig.png);">
	<table>
		<tr>
			<td>
				<label class="usvn_label" for="login">
				<?php echo T_("Login");?>:
			</td>
			<td>
				<input type="text" name="login" id="login" maxlength="255" value="<?php
					if (isset($_POST['login'])) {
						echo $_POST['login'];
					}
					else {
						echo "admin";
					}
				?>"/>
				</label>
			</td>
		</tr>
		<tr>
			<td>
				<label class="usvn_label" for="firstname">
				<?php echo T_("Firstname");?>:
			</td>
			<td>
				<input type="text" name="firstname" id="firstname" maxlength="100" value="<?php
					if (isset($_POST['firstname'])) {
						echo $_POST['firstname'];
					}
					else {
						echo T_("System");
					}
				?>"/>
				</label>
			</td>
		</tr>
		<tr>
			<td>
				<label class="usvn_label" for="lastname">
				<?php echo T_("Lastname");?>:
			</td>
			<td>
				<input type="text" name="lastname" id="lastname" maxlength="100" value="<?php
					if (isset($_POST['lastname'])) {
						echo $_POST['lastname'];
					}
					else {
						echo T_("Administrator");
					}
				?>"/>
				</label>
			</td>
		</tr>
		<tr>
			<td>
				<label class="usvn_label" for="password">
				<?php echo T_("Password");?>:
			</td>
			<td>
				<input type="password" name="password" id="password" />
				</label>
			</td>
		</tr>
		<tr>
			<td>
				<label class="usvn_label" for="password2">
				<?php echo T_("Confirm password");?>:
			</td>
			<td>
				<input type="password" name="password2" id="password2" />
				</label>
			</td>
		</tr>
		<tr>
			<td>
				<label class="usvn_label" for="email">
				<?php echo T_("Email");?>:
			</td>
			<td>
				<input type="text" name="email" id="email" maxlength="150" value="<?php
					if (isset($_POST['email'])) {
						echo $_POST['email'];
					}
				?>"/>
				</label>
			</td>
		</tr>
	</table>
</div>
	<hr />
	<input type="submit" value="<?php echo T_("Next step");?>" onclick="return checkForm();" />
</form>
